<?php
declare (strict_types = 1);

namespace app\validate;

use app\lib\MyValid;

class UserValid extends MyValid
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array
     */	
	protected $rule = [
        'username|用户名'           => ['require', 'alphaDash'],
        'password|密码'             => ['require', 'alphaDash'],
        'password_confirm|重复密码' => ['require', 'confirm:password'],
        // 基础信息编辑
        'nickname|昵称'         => ['chsAlphaNum'],
        'email|邮箱'            => ['email'],
        'phone|手机号'          => ['mobile'],
    ];
    
    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */	
    protected $message = [];

    protected $scene = [
        'login' => ['username', 'password'],
        'regist' => ['username', 'password', 'password_confirm'],
        'modify' => ['nickname', 'email', 'phone']
    ];
}
